package com.water.camera.mark;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.water.camera.bean.EditItem;
import com.water.camera.databinding.LayoutWatermark91Binding;

import java.util.ArrayList;

public class Mark91 extends BaseMark {

    LayoutWatermark91Binding binding;

    public Mark91(@NonNull Context context) {
        super(context);
    }

    public Mark91(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public Mark91(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void init(int type) {
        if (type == 0) {
            binding = LayoutWatermark91Binding.inflate(LayoutInflater.from(getContext()));
            addView(binding.getRoot());
            hideView(binding.binding20);
            for (int i = 3; i < binding.binding1.getChildCount(); i++) {
                binding.binding1.getChildAt(i).setVisibility(View.GONE);
            }
        } else {
            binding = LayoutWatermark91Binding.inflate(LayoutInflater.from(getContext()), this, true);
        }
        update();
    }

    @Override
    public void update() {
        setText(binding.title, "title91", binding.titleLl);
        setText(binding.binding3, "area91", binding.binding2);
        setText(binding.binding5, "content91", binding.binding4);
        setText(binding.binding7, "shigong91", binding.binding6);
        setText(binding.binding9, "jianli91", binding.binding8);
        setText(binding.binding11, "weather91", "晴", binding.binding10);
        setText(binding.binding13, "didian91", "在这里", binding.binding12);
        setText(binding.binding15, "haiba91", binding.binding14);
        setText(binding.binding17, "jingwei91", binding.binding16);
        setText(binding.binding19, "beizhu91", binding.binding18);
        setText(binding.binding22, "jianshedanwei91", binding.binding21);
        setText(binding.binding24, "jianlidanwei91", binding.binding23);
        setText(binding.binding26, "shigongdanwei91", binding.binding25);
        setText(binding.binding28, "shejidanwei91", binding.binding27);
        setText(binding.binding30, "kanchadanwei91", binding.binding29);

        super.update();
    }

    @Override
    public ArrayList<EditItem> getEditItems() {
        ArrayList<EditItem> list = new ArrayList<>();
        list.add(new EditItem("title91", "项目名称"));
        list.add(new EditItem("area91", "施工区域"));
        list.add(new EditItem("content91", "施工内容"));
        list.add(new EditItem("shigong91", "施工责任人"));
        list.add(new EditItem("jianli91", "监理责任人"));
        list.add(new EditItem("weather91", "天气"));
        list.add(new EditItem("didian91", "地点"));
        list.add(new EditItem("haiba91", "海拔"));
        list.add(new EditItem("jingwei91", "经纬度"));
        list.add(new EditItem("beizhu91", "备注"));
        list.add(new EditItem("jianshedanwei91", "建设单位"));
        list.add(new EditItem("jianlidanwei91", "监理单位"));
        list.add(new EditItem("shigongdanwei91", "施工单位"));
        list.add(new EditItem("shejidanwei91", "设计单位"));
        list.add(new EditItem("kanchadanwei91", "勘察单位"));
        return list;
    }
}
